<?php

if (!defined('BASEPATH'))
	exit('No direct script access allowed');

/**
 * Description of attribute
 *
 * @author b4by
 */
class attribute extends MY_Controller{
	function __construct() {
		parent::__construct();
		$this->load->model('model_attribute');
		$this->load->model('model_attribute_info');
	}
	
	public function index()
	{
		$this->data['temp'] = 'admin/attribute/index';
		$this->load->view('admin/main',$this->data);
	}
	
	public function read()
	{
		$attributes = $this->model_attribute->get_list_hash($this->siteConfig->lang,array(
			'order'	=> array('index','asc')
		));
		
		//Tao object tree
		array_to_object($attributes);
		
		// THem prefix
		object_prefix_create($attributes, '', '&nbsp;&nbsp;&nbsp;&nbsp;');
		
		//Chuyen sang mang
		$data = array();
		object_to_array($data, $attributes);
		
		echo json_encode(array(
			'state'	=> 'success',
			'data'	=> $data
		));
	
		
	}
	
	public function create()
	{
		$this->load->helper('form');
		$this->load->library('form_validation');
		
		$this->form_validation->set_rules('');
	}
	
}

?>
